﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pharmacy.BusinessEntities;

namespace Pharmacy.Repository.Mapping
{
    public class ClienteMap:EntityTypeConfiguration<Cliente>
    {
        public ClienteMap()
        {
            this.HasKey(p => p.Id);
            this.Property(p => p.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(p => p.Nombres)
                .IsRequired()
                .HasMaxLength(90);

            this.Property(p => p.DNI)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(p => p.Direccion)
                .IsOptional()
                .HasMaxLength(100);

            this.Property(p => p.Apellidos)
                .IsOptional()
                .HasMaxLength(150);

            this.ToTable("CLIENTE");
        }
    }
}
